

export default {
    functional: true, // 函数式组件
    render(h, { parent, data }) {

        data.routeView = true
        let route = parent.$route;
        let depth = 0; // 由于先父后子 从上到下   depth 记录层级

        while (parent) {
            if (parent.$vnode && parent.$vnode.data.routeView) {
                depth++
            }
            parent = parent.$parent
        }

        let record = route.matched[depth]
        if (!record) {
            return h()
        }
        console.log(record)
        return h(record.component, data)
    }
}